<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>新增/修改</title>
</head>
<body>
<form method="post" action="/addInfo">

    <input th:if="${bookInfo != null}" type="text" th:value="${bookInfo.getId()}" style="display: none" name="id">
    <table border="1px">
        <tr>
            <td>书名</td>
            <td>
                <input type="text" name="name" th:value="${bookInfo != null?bookInfo.getName():''}"/>
            </td>
        </tr>

        <tr>
            <td>价格</td>
            <td>
                <input type="text" name="price" th:value="${bookInfo != null?bookInfo.getPrice():''}"/>
            </td>
        </tr>

        <tr>
            <td>类目</td>
            <td>
                <input type="text" name="category" th:value="${bookInfo != null?bookInfo.getCategory():''}"/>
            </td>
        </tr>

        <tr>
            <td>库存</td>
            <td>
                <input type="text" name="pnum" th:value="${bookInfo != null?bookInfo.getPnum():''}"/>
            </td>
        </tr>

        <tr>
            <td>图片</td>
            <td>
                <input type="text" name="imgurl" th:value="${bookInfo != null?bookInfo.getImgurl():''}"/>
            </td>
        </tr>

        <tr>
            <td>说明</td>
            <td>
                <input type="text" name="description" th:value="${bookInfo != null?bookInfo.getDescription():''}"/>
            </td>
        </tr>

        <tr>
            <td>作者</td>
            <td>
                <input type="text" name="author" th:value="${bookInfo != null?bookInfo.getAuthor():''}"/>
            </td>
        </tr>

        <tr>
            <td>已售</td>
            <td>
                <input type="text" name="sales" th:value="${bookInfo != null?bookInfo.getSales():''}"/>
            </td>
        </tr>

        <tr>
            <td colspan="2">
                <input type="submit" value="确定"/>
                <input type="button" onclick="javascript:window.location.href='/page'" value="取消"/>
            </td>
        </tr>
    </table>
</form>
</body>
<script src="/js/jquery-3.5.1.js"></script>
</html>